<template>
  <div class="home">
   <alertActivity v-if="new Date().getDate() <= 10 ||
      (new Date().getDate() == 11 && new Date().getHours() < 23)
      " /> 
    <alert v-else /> 
    <Top />
    <div class="bg-home">
      <Swipe />
      <!-- <Notice/> -->
      <!-- <van-notice-bar
  left-icon="volume-o" 
  background="transparent"
  text="根据国家节假日放假的相关规定，公司1月1日-1月3日放假，12月31日至1月3日的订单，将于1月4日陆续为您发货，给您带来的不便，敬请谅解。祝新年快乐，万事如意！"
/> -->
      <!-- 旧版嗨11发布 -->
      <IndexSix class="content-box" v-if="(new Date().getDate() == 10 && new Date().getHours() >= 22) ||
        (new Date().getDate() == 11 && new Date().getHours() < 23)
        " />

      <!-- 旧版嗨11测试 -->
      <!-- <IndexSix class="content-box" v-if="new Date().getDate() == 9 &&
        ((new Date().getHours() == 22 && new Date().getMinutes() >= 0) &&
          (new Date().getHours() == 22 && new Date().getMinutes() < 30))
        " /> -->

      <!-- 嗨11发布 -->
      <!-- <indexNewSix class="content-box" v-if="(new Date().getDate() == 10 && new Date().getHours() >= 22) ||
        (new Date().getDate() == 11 && new Date().getHours() < 23)
        " /> -->

      <indexNewSix class="content-box"
        v-if="new Date().getDate() >= 13" />

      <!-- 嗨11测试 -->
      <!-- <indexNewSix class="content-box" v-if="new Date().getDate() == 9 &&
        ((new Date().getHours() == 22 && new Date().getMinutes() >= 0) &&
          (new Date().getHours() == 22 && new Date().getMinutes() < 30))
        " /> -->

      <!-- (new Date().getDate()==6 &&( (newDate().getHours()>=8)||(newDate().getHours()<9)) -->
      <!-- <chrismas
        class="content-box"
        v-if="
          new Date().getDate() == 26 ||
            new Date().getDate() == 27 ||
            new Date().getDate() == 28
        "
      /> -->



      <lazy-component>
        <IndexFour class="content-box" />
      </lazy-component>

      <lazy-component>
        <IndexFive class="content-box" />
      </lazy-component>

      <lazy-component>
        <IndexThree class="content-box" />
      </lazy-component>
      <lazy-component>
        <IndexOne class="content-box" />
      </lazy-component>

      <lazy-component>
        <IndexSeven class="content-box" />
      </lazy-component>
      <lazy-component>
        <indexEight class="content-box" />
      </lazy-component>
      <lazy-component>
        <Country class="content-box" />
      </lazy-component>

      <NavBar />
    </div>

    <!-- <keep-alive>
    <component :is="Goods" />
  </keep-alive> -->
    <lazy-component>
      <Goods />
    </lazy-component>>
    <Kefu />
  </div>
</template>
<script>
import indexNewSix from "@/components/activity/indexNewSix";
import alertActivity from "@/components/home/alert";
import NavBar from "@/components/home/NavBar";
import alert from "@/components/home/alert2.vue";
import Top from "@/components/home/top";
import Swipe from "@/components/home/swipe";
import IndexOne from "@/components/activity/indexOne";
import IndexThree from "@/components/activity/indexThree";
import IndexFour from "@/components/activity/indexFour";
import IndexFive from "@/components/activity/indexFive";
import IndexSix from "@/components/activity/indexSix";
import IndexSeven from "@/components/activity/indexSeven.vue";
import IndexEight from "@/components/activity/indexEight"
import Country from "@/components/activity/country";
// import Notice from "@/components/activity/notice";
import Goods from "@/components/home/goods";
import Kefu from "@/components/lib/kefu";
import { onActivated, onDeactivated } from "vue";
// import Chrismas from "@/components/activity/christmasDay.vue";
// import { Warning } from "@/api/ecstore";
import { wxapi } from "@/lib/ecapi";
// import { Dialog } from "vant";
export default {
  components: {
    NavBar,
    Top,
    Swipe,
    Goods,
    IndexOne,
    IndexThree,
    IndexFour,
    IndexFive,
    IndexSeven,
    alert,
    IndexEight,
    // Chrismas,
    IndexSix,
    Country,
    // Notice,
    indexNewSix,
    Kefu,
    alertActivity,
  },
  setup() {
    // const onLoad = async () => {
    // const res = await Warning();
    // console.log("22", res);
    // Dialog.confirm({
    //   message: res[1],
    //   allowHtml: true,
    //   confirmButtonText: "同意",
    //   cancelButtonText: "拒绝",
    // })
    //   .then(() => {
    //     localStorage.setItem("ISAGREE_INDEX", true);
    //   })
    //   .catch(() => {
    //     localStorage.setItem("ISAGREE_INDEX", false);
    //   });
    // onLoad();
    // };
    // if (navigator.userAgent.indexOf("haiguang_mobile") > -1) {
    // if (
    //   !localStorage.getItem("ISAGREE_INDEX") ||
    //   localStorage.getItem("ISAGREE_INDEX") == "false"
    // ) {
    // }
    // onLoad();
    // }

    let scrollTop = 0;
    onActivated(() => {
      // document.getElementById("app").addEventListener("scroll", () => {
      // });
      wxapi(
        "嗨逛全球",
        "精彩嗨逛，乐享全球！",
        "http://www.higuang365.com/wap/#/home",
        "http://higuang365.com/public/app/site/statics/favicon.ico"
      );
      document.getElementById("app").scrollTop = scrollTop;
    });
    onDeactivated(() => {
      scrollTop = document.getElementById("app").scrollTop;
    });
  },
};
</script>
<style lang="scss" scoped>
.home {

  // 公祭日开启
  // filter: grayscale(100%);
  //   background: #f7f7f7;
  // background: f3f4f8;
  // border: solid .4rem #9b1112;
  &::before {
    content: "";
    width: 100%;
    height: 100%;
    background: #f3f4f8;
    // background: url(http://www.higuang365.com/public/images/common/year/bg.png);
    background-size: contain;
    display: block;
    position: absolute;
    z-index: -1;
  }

  .bg-home {
    // background: url("http://www.higuang365.com/public/images/common/activity/activity/bg-middle.png")
    //   no-repeat;
    // background-size: 100% 100%;
    background-image: linear-gradient(to bottom,
        #ffbb00,
        #ff5300);
    padding: 0.1rem 0 0.5rem;
  }
}

.notice-swipe {
  height: 40px;
  line-height: 40px;
}

.content-box {
  margin: 1rem;
  background: #fff;
  padding: 1rem;
  border-radius: 1rem;
  overflow: hidden;
}

.content-box2 {

  margin-top: 0rem;
  margin-left: 1rem;
  margin-right: 1rem;
  margin-bottom: 1rem;
  background: #fff;
  padding-top: 0rem;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-bottom: 1rem;
  border-radius: 0px 0px 1rem 1rem;
  overflow: hidden;
}

.content-box3 {

  margin-top: 1rem;
  margin-left: 1rem;
  margin-right: 1rem;
  margin-bottom: 0rem;
  background: #fff;
  padding-top: 1rem;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-bottom: 0.6rem;
  border-radius: 1rem 1rem 0px 0px;
  overflow: hidden;
}

.content-box-hai11 {
  margin: 1rem;
  background: #fff;

  border-radius: 1rem;
  overflow: hidden;
}

.van-dialog__message {
  white-space: normal;

  a {
    color: blue;
  }
}
</style>
